<template>
	<view class="wrap">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">防控详情信息</block>
		</cu-custom>

		<view class="mian" v-model="item">
			<view class="demo-warter w-50 ">
				<view class="demo-title">
					{{item.specyName}}
				</view>
				<view class="spe_img">
					<image v-if="item.harmImage" :src="baseUrl+item.harmImage" mode=""></image>
					<image v-if="!item.harmImage" :src="imagedf" mode=""></image>
				</view>
				<view class="foot">
					<view class="demo-text">
						农业措施:
					</view>
					<view class="demo-text-sm">
						{{item.agriculturalMethod}}
					</view>
					<view class="demo-text">
						生物防控:
					</view>
					<view class="demo-text-sm">
						{{item.biologicalMethod}}
					</view>
					<view class="demo-text">

						化学措施:
					</view>
					<view class="demo-text-sm">
						{{item.chemicalMethod}}
					</view>
					<view class="demo-text">
						物理措施:
					</view>
					<view class="demo-text-sm">
						{{item.physicalMethod}}
					</view>
					<view class="demo-text">

						危害简介:
					</view>
					<view class="demo-text-sm">
						{{item.preventionIntroduction}}
					</view>
				</view>




				<!-- <u-icon name="close-circle-fill" color="#fa3534" size="34" class="u-close" @click="remove(item.id)"></u-icon> -->
			</view>
		</view>
	</view>



</template>

<script>
	import proData from "@/common/projectData.js";
	import imgData from "@/common/uiImg.js";
	import {
		baseUrl
	} from '../../common/utils/request.js'
	import {
		getAnimalInfo,
		getAnimalDtil,
		getPlantInfo,
		getPlantDtil,
		getMicrobeInfo,
		getMicrobeIDtil,
		getpreventionInfo,
		getpreventionDtil
	} from '../../common/api/info.js';
	import {
		checkNullAndUndefine
	} from '../../common/utils/checkNU.js';
	export default {
		data() {
			return {
				baseUrl: '',
				item: {},
				imagedf: 'https://iph.href.lu/250x250?text=防控图片',
				queryParams: {}
			}
		},
		onLoad(option) {
			this.baseUrl = baseUrl
			console.log(option.preventionId)
			// this.type = option.type;
			this.addRandomData(option.preventionId);
		},
		// onReachBottom() {
		// 	this.loadStatus = 'loading';
		// 	// 模拟数据加载
		// 	setTimeout(() => {
		// 		this.addRandomData();
		// 		this.loadStatus = 'loadmore';
		// 	}, 1000)
		// },
		methods: {
			addRandomData(preventionId) {
				getpreventionDtil(preventionId).then(response => {
					console.log(response);
					this.item = response[1].data.data;
					
					for (let i in this.item) {
						if (i != 'harmImage') {
							this.item[i] = checkNullAndUndefine(this.item[i])
						}
					}
				});
				
			}
		}
	}
</script>

<style>
	/* page不能写带scope的style标签中，否则无效 */
	page {
		background-color: rgb(240, 240, 240);
	}
</style>

<style lang="scss" scoped>
	.spe_img {
		padding: 10px;
	}

	.demo-image {
		width: 100%;
		border-radius: 4px;
	}

	.demo-title {
		font-size: 45rpx;
		margin-top: 5px;
		color: $u-main-color;
	}

	.demo-tag {
		display: flex;
		margin-top: 15rpx;
		margin-bottom: 15rpx;
	}

	.demo-tag-owner {
		background-color: $u-type-success;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		padding: 4rpx 14rpx;
		border-radius: 50rpx;
		font-size: 20rpx;
		line-height: 1;
	}

	.demo-tag-text {
		border: 1px solid $u-type-success;
		color: $u-type-success;
		margin-left: 10px;
		border-radius: 50rpx;
		line-height: 1;
		padding: 4rpx 14rpx;
		display: flex;
		align-items: center;
		border-radius: 50rpx;
		font-size: 20rpx;
	}

	.demo-text-sm {
		margin: 10px;
		line-height: 2;
	}

	.demo-text {
		margin: 10px;
		line-height: 2;
		font-weight: 700;
	}

	.demo-shop {
		font-size: 22rpx;
		color: $u-tips-color;
		margin-top: 5px;
	}

	.mian {
		width: 257%;
	}

	.w-50 {
		width: 38%;
	}

	.demo-warter {
		border-radius: 8px;
		margin: 10px 5px;
		background-color: #ffffff;
		padding: 8px;
		position: relative;
	}

	.dtile {
		display: flex;
		flex-wrap: wrap;
	}

	.rit {
		margin-left: 5px;
	}

	.foot {
		margin-left: 5px;
	}
</style>
